/**
 * storeAPI
 *   dispatch 现在指的是原生的dispatch
 *   getState
 * @param {*} param0 
 * @returns 
 */
function thunk({dispatch,getState}) {
    return function (next) {//store.dispatch
        //store.dispatch(action)
        return function (action) {
          //如果派发的action是一个函数的话
          if(typeof action === 'function'){
            return action(dispatch,getState);
          }else{
            return next(action);
          }
        }
    }
}
export default thunk;